/*
 * XML Type:  EAnnotation
 * Namespace: http://www.eclipse.org/emf/2002/Ecore
 * Java type: org.eclipse.emf.x2002.ecore.EAnnotation
 *
 * Automatically generated - do not modify.
 */
package org.eclipse.emf.x2002.ecore.impl;
/**
 * An XML EAnnotation(@http://www.eclipse.org/emf/2002/Ecore).
 *
 * This is a complex type.
 */
public class EAnnotationImpl extends org.eclipse.emf.x2002.ecore.impl.EModelElementImpl implements org.eclipse.emf.x2002.ecore.EAnnotation
{
    private static final long serialVersionUID = 1L;
    
    public EAnnotationImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName DETAILS$0 = 
        new javax.xml.namespace.QName("", "details");
    private static final javax.xml.namespace.QName CONTENTS$2 = 
        new javax.xml.namespace.QName("", "contents");
    private static final javax.xml.namespace.QName SOURCE$4 = 
        new javax.xml.namespace.QName("", "source");
    private static final javax.xml.namespace.QName REFERENCES$6 = 
        new javax.xml.namespace.QName("", "references");
    
    
    /**
     * Gets array of all "details" elements
     */
    public org.eclipse.emf.x2002.ecore.EStringToStringMapEntry[] getDetailsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(DETAILS$0, targetList);
            org.eclipse.emf.x2002.ecore.EStringToStringMapEntry[] result = new org.eclipse.emf.x2002.ecore.EStringToStringMapEntry[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "details" element
     */
    public org.eclipse.emf.x2002.ecore.EStringToStringMapEntry getDetailsArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EStringToStringMapEntry target = null;
            target = (org.eclipse.emf.x2002.ecore.EStringToStringMapEntry)get_store().find_element_user(DETAILS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "details" element
     */
    public int sizeOfDetailsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(DETAILS$0);
        }
    }
    
    /**
     * Sets array of all "details" element  WARNING: This method is not atomicaly synchronized.
     */
    public void setDetailsArray(org.eclipse.emf.x2002.ecore.EStringToStringMapEntry[] detailsArray)
    {
        check_orphaned();
        arraySetterHelper(detailsArray, DETAILS$0);
    }
    
    /**
     * Sets ith "details" element
     */
    public void setDetailsArray(int i, org.eclipse.emf.x2002.ecore.EStringToStringMapEntry details)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EStringToStringMapEntry target = null;
            target = (org.eclipse.emf.x2002.ecore.EStringToStringMapEntry)get_store().find_element_user(DETAILS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(details);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "details" element
     */
    public org.eclipse.emf.x2002.ecore.EStringToStringMapEntry insertNewDetails(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EStringToStringMapEntry target = null;
            target = (org.eclipse.emf.x2002.ecore.EStringToStringMapEntry)get_store().insert_element_user(DETAILS$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "details" element
     */
    public org.eclipse.emf.x2002.ecore.EStringToStringMapEntry addNewDetails()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EStringToStringMapEntry target = null;
            target = (org.eclipse.emf.x2002.ecore.EStringToStringMapEntry)get_store().add_element_user(DETAILS$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "details" element
     */
    public void removeDetails(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(DETAILS$0, i);
        }
    }
    
    /**
     * Gets array of all "contents" elements
     */
    public org.apache.xmlbeans.XmlObject[] getContentsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(CONTENTS$2, targetList);
            org.apache.xmlbeans.XmlObject[] result = new org.apache.xmlbeans.XmlObject[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "contents" element
     */
    public org.apache.xmlbeans.XmlObject getContentsArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlObject target = null;
            target = (org.apache.xmlbeans.XmlObject)get_store().find_element_user(CONTENTS$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "contents" element
     */
    public int sizeOfContentsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(CONTENTS$2);
        }
    }
    
    /**
     * Sets array of all "contents" element  WARNING: This method is not atomicaly synchronized.
     */
    public void setContentsArray(org.apache.xmlbeans.XmlObject[] contentsArray)
    {
        check_orphaned();
        arraySetterHelper(contentsArray, CONTENTS$2);
    }
    
    /**
     * Sets ith "contents" element
     */
    public void setContentsArray(int i, org.apache.xmlbeans.XmlObject contents)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlObject target = null;
            target = (org.apache.xmlbeans.XmlObject)get_store().find_element_user(CONTENTS$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(contents);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "contents" element
     */
    public org.apache.xmlbeans.XmlObject insertNewContents(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlObject target = null;
            target = (org.apache.xmlbeans.XmlObject)get_store().insert_element_user(CONTENTS$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "contents" element
     */
    public org.apache.xmlbeans.XmlObject addNewContents()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlObject target = null;
            target = (org.apache.xmlbeans.XmlObject)get_store().add_element_user(CONTENTS$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "contents" element
     */
    public void removeContents(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(CONTENTS$2, i);
        }
    }
    
    /**
     * Gets the "source" attribute
     */
    public java.lang.String getSource()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SOURCE$4);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "source" attribute
     */
    public org.eclipse.emf.x2002.ecore.EString xgetSource()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EString target = null;
            target = (org.eclipse.emf.x2002.ecore.EString)get_store().find_attribute_user(SOURCE$4);
            return target;
        }
    }
    
    /**
     * True if has "source" attribute
     */
    public boolean isSetSource()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(SOURCE$4) != null;
        }
    }
    
    /**
     * Sets the "source" attribute
     */
    public void setSource(java.lang.String source)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(SOURCE$4);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(SOURCE$4);
            }
            target.setStringValue(source);
        }
    }
    
    /**
     * Sets (as xml) the "source" attribute
     */
    public void xsetSource(org.eclipse.emf.x2002.ecore.EString source)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EString target = null;
            target = (org.eclipse.emf.x2002.ecore.EString)get_store().find_attribute_user(SOURCE$4);
            if (target == null)
            {
                target = (org.eclipse.emf.x2002.ecore.EString)get_store().add_attribute_user(SOURCE$4);
            }
            target.set(source);
        }
    }
    
    /**
     * Unsets the "source" attribute
     */
    public void unsetSource()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(SOURCE$4);
        }
    }
    
    /**
     * Gets the "references" attribute
     */
    public java.util.List getReferences()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(REFERENCES$6);
            if (target == null)
            {
                return null;
            }
            return target.getListValue();
        }
    }
    
    /**
     * Gets (as xml) the "references" attribute
     */
    public org.eclipse.emf.x2002.ecore.EAnnotation.References xgetReferences()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EAnnotation.References target = null;
            target = (org.eclipse.emf.x2002.ecore.EAnnotation.References)get_store().find_attribute_user(REFERENCES$6);
            return target;
        }
    }
    
    /**
     * True if has "references" attribute
     */
    public boolean isSetReferences()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(REFERENCES$6) != null;
        }
    }
    
    /**
     * Sets the "references" attribute
     */
    public void setReferences(java.util.List references)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(REFERENCES$6);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(REFERENCES$6);
            }
            target.setListValue(references);
        }
    }
    
    /**
     * Sets (as xml) the "references" attribute
     */
    public void xsetReferences(org.eclipse.emf.x2002.ecore.EAnnotation.References references)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.eclipse.emf.x2002.ecore.EAnnotation.References target = null;
            target = (org.eclipse.emf.x2002.ecore.EAnnotation.References)get_store().find_attribute_user(REFERENCES$6);
            if (target == null)
            {
                target = (org.eclipse.emf.x2002.ecore.EAnnotation.References)get_store().add_attribute_user(REFERENCES$6);
            }
            target.set(references);
        }
    }
    
    /**
     * Unsets the "references" attribute
     */
    public void unsetReferences()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(REFERENCES$6);
        }
    }
    /**
     * An XML references(@).
     *
     * This is a list type whose items are org.apache.xmlbeans.XmlAnyURI.
     */
    public static class ReferencesImpl extends org.apache.xmlbeans.impl.values.XmlListImpl implements org.eclipse.emf.x2002.ecore.EAnnotation.References
    {
        private static final long serialVersionUID = 1L;
        
        public ReferencesImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType, false);
        }
        
        protected ReferencesImpl(org.apache.xmlbeans.SchemaType sType, boolean b)
        {
            super(sType, b);
        }
    }
}
